<?php

/**
 * Customer_m
 */
class Customer_m extends CI_Model {

	function __construct()
	{
		parent::__construct();
		//$this->load->database();
	}

	
	function get_customer_lists($arr){
		$query = "select * from customer where 1 = 1  " ;
		 
		$param = array();
// 		if(!empty($arr["s_commoditycode_from"])) {
// 			$query = $query." AND ch.commodity_code >=  ? ";
// 			array_push($param,$arr["s_commoditycode_from"]);
// 		}
// 		if(!empty($arr["s_commoditycode_to"])) {
// 			$query  = $query. " AND ch.commodity_code <=  ? ";
// 			array_push($param,$arr["s_commoditycode_to"]);
// 		}
// 		if(!empty($arr["s_skucode"])) {
// 			$query  = $query. " AND cd.sku_code = ? ";
// 			array_push($param,$arr["s_skucode"]);
// 		}else{
// 			$query  = $query. " AND cd.sku_code = ch.represent_sku_code ";
// 		}
		 
		return $this->db->query($query,$param)->result();
	}
	
	function address($params = array()){
		if (! is_array($params) OR count($items) == 0){
			return ;
		}
		if(!empty($param['customer_code'])) {
			$this->db->where(array('customer_code' => $param['customer_code'] ));
		}
		if(!empty($param['address_no'])) {
			$this->db->where(array('address_no' => $param['address_no'] ));
		}
		return  $this->db->get('customer_address')->result();
	}

	function customer($params = array()){
		if (! is_array($params) OR count($items) == 0){
			return ;
		}
		if(!empty($param['customer_code'])) {
			$this->db->where(array('customer_code' => $param['customer_code'] ));
		}	
		return  $this->db->get('customer')->result();
	}
	
}
/* End of file customer.php */
/* Location: s./zswebshop/models/customer.php */